package br.edu.ufcg.lsd.wbis.common;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import br.edu.ufcg.lsd.wbis.control.exception.CannotOpenDatabaseSessionException;
import br.edu.ufcg.lsd.wbis.control.util.HibernateUtil;

public class HibernateDAO {

	protected Session session;

	public HibernateDAO() throws CannotOpenDatabaseSessionException {
		try {
			SessionFactory sessionFactory = HibernateUtil.getInstance().getSessionFactory();
			session = sessionFactory.openSession();
		} catch (HibernateException e) {
			e.printStackTrace();
			throw new CannotOpenDatabaseSessionException(e);
		}

	}
	
}
